<?php 

use_stylesheet('list.css');
use_helper('toolsbar');
slot('Toolsbar');
   echo setToolbar('index','client');
end_slot();

slot('PageTitle',"Client");
slot('Title',"Client Overview");   
 
?>
<table id="lista">
  <thead>
    <tr>
      <th <?php if ($sf_user->getOrderField()=='name') echo 'class=order'?>><a href="<?php echo url_for('client')."?orderBy=name"?>">Name</a></th>
      <th <?php if ($sf_user->getOrderField()=='ref1') echo 'class=order'?>><a href="<?php echo url_for('client')."?orderBy=ref1"?>">Ref 1</a></th>
      <th <?php if ($sf_user->getOrderField()=='ref2') echo 'class=order'?>><a href="<?php echo url_for('client')."?orderBy=ref2"?>">Ref 2</a></th>
      <th <?php if ($sf_user->getOrderField()=='ref3') echo 'class=order'?>><a href="<?php echo url_for('client')."?orderBy=ref3"?>">Ref 3</a></th>
      <th <?php if ($sf_user->getOrderField()=='address') echo 'class=order'?>><a href="<?php echo url_for('client')."?orderBy=address"?>">Address</a></th>
      <th <?php if ($sf_user->getOrderField()=='note') echo 'class=order'?>><a href="<?php echo url_for('client')."?orderBy=note"?>">Note</a></th>
    </tr>
  </thead>
  <tbody>
   <?php foreach ($clients as $key=>$client): $odd = fmod($key, 2) ? 'odd' : 'even'?>
    <tr class="<?php echo $odd ?>">
      <td><a href='<?php echo url_for('client_show',$client)?>'> <?php echo $client->getName() ?> </a></td>
      <td><a href='<?php echo url_for('contact_show',$client->getContact())?>'><?php echo $client->getContact() ?></a></td>
      <td><a href='<?php echo url_for('contact_show',$client->getContact_2())?>'><?php echo $client->getContact_2() ?></a></td>
      <td><a href='<?php echo url_for('contact_show',$client->getContact_3())?>'><?php echo $client->getContact_3() ?></a></td>
      <td><?php echo $client->getNote() ?></td>
      <td><?php echo $client->getAddress() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
